﻿using Common.Device.Enums;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.Device.ViewModels
{
    public class DianZiFuZaiViewModel:BindableBase
    {
        private int menuIndex = 0;
        /// <summary>
        /// 菜单索引
        /// </summary>
        public int MenuIndex
        {
            get { return menuIndex; }
            set { SetProperty(ref menuIndex, value); }
        }
        /// <summary>
        /// 设置负载方式集合
        /// </summary>
        public List<string> SetFuZaiModes { get; set; } = Enum.GetNames(typeof(DianZiFuZaiEnum.DianZiFuZaiMode)).ToList();
        /// <summary>
        /// 读取负载方式集合
        /// </summary>
        public List<string> ReadFuZaiModes { get; set; } = new List<string> { "电压", "电流", "功率" };

        private string setMode = DianZiFuZaiEnum.DianZiFuZaiMode.电压.ToString();
        /// <summary>
        /// 设置负载方式
        /// </summary>
        public string SetMode
        {
            get { return setMode; }
            set{ SetProperty(ref setMode, value);
                switch (setMode)
                {
                    case "电压": SetUnit = "V"; break;
                    case "电流": SetUnit = "A"; break;
                    case "电阻": SetUnit = "Ω"; break;
                    case "功率": SetUnit = "W"; break;
                    default:
                        break;
                }
            }
        }
        private string setUnit = "V";
        /// <summary>
        /// 负载消耗值单位
        /// </summary>
        public string SetUnit
        {
            get { return setUnit; }
            set { SetProperty(ref setUnit, value); }
        }
        private string setValue;
        /// <summary>
        /// 负载消耗值
        /// </summary>
        public string SetValue
        {
            get { return setValue; }
            set { SetProperty(ref setValue, value); }
        }
        private string readSetMode = DianZiFuZaiEnum.DianZiFuZaiMode.电压.ToString();
        /// <summary>
        /// 读取负载方式
        /// </summary>
        public string ReadSetMode
        {
            get { return readSetMode; }
            set { SetProperty(ref readSetMode, value);
                switch (readSetMode)
                {
                    case "电压": ReadSetUnit = "V"; break;
                    case "电流": ReadSetUnit = "A"; break;
                    case "电阻": ReadSetUnit = "Ω"; break;
                    case "功率": ReadSetUnit = "W"; break;
                    default:
                        break;
                }
            }
        }
        private string readSetUnit = "V";
        /// <summary>
        /// 读取设置负载单位
        /// </summary>
        public string ReadSetUnit
        {
            get { return readSetUnit; }
            set { SetProperty(ref readSetUnit, value); }
        }
        private string readSetMin = null;
        /// <summary>
        /// 读取设置负载最小值
        /// </summary>
        public string ReadSetMin
        {
            get { return readSetMin; }
            set { SetProperty(ref readSetMin, value); }
        }
        private string readSetMax = null;
        /// <summary>
        /// 读取设置负载最大值
        /// </summary>
        public string ReadSetMax
        {
            get { return readSetMax; }
            set { SetProperty(ref readSetMax, value); }
        }
        private string readCurrentMode = DianZiFuZaiEnum.DianZiFuZaiMode.电压.ToString();
        /// <summary>
        /// 读取当前负载模式
        /// </summary>
        public string ReadCurrentMode
        {
            get { return readCurrentMode; }
            set { SetProperty(ref readCurrentMode, value);
                switch (readCurrentMode)
                {
                    case "电压": ReadCurrentUnit = "V"; break;
                    case "电流": ReadCurrentUnit = "A"; break;
                    case "电阻": ReadCurrentUnit = "Ω"; break;
                    case "功率": ReadCurrentUnit = "W"; break;
                    default:
                        break;
                }
            }
        }
        private string readCurrentUnit = "V";
        /// <summary>
        /// 读取当前负载单位
        /// </summary>
        public string ReadCurrentUnit
        {
            get { return readCurrentUnit; }
            set { SetProperty(ref readCurrentUnit, value); }
        }
        private string readCurrentMin = null;
        /// <summary>
        /// 读取当前负载最小值
        /// </summary>
        public string ReadCurrentMin
        {
            get { return readCurrentMin; }
            set { SetProperty(ref readCurrentMin, value); }
        }
        private string readCurrentMax = null;
        /// <summary>
        /// 读取当前负载最大值
        /// </summary>
        public string ReadCurrentMax
        {
            get { return readCurrentMax; }
            set { SetProperty(ref readCurrentMax, value); }
        }
    }
}
